home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / CIncludes / QD3D.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-12  |  39.9 KB  |  1,223 lines  |  [TEXT/MPS ]

  1. /******************************************************************************
  2.  **                                                                              **
  3.  **     Module:        QD3D.h                                                     **                        
  4.  **                                                                              **
  5.  **                                                                              **
  6.  **     Purpose:     System include file.                                     **            
  7.  **                                                                              **
  8.  **                                                                              **
  9.  **                                                                              **
  10.  **     Copyright (C) 1992-1997 Apple Computer, Inc.  All rights reserved.     **
  11.  **                                                                              **
  12.  **                                                                              **
  13.  *****************************************************************************/
  14. #ifndef QD3D_h
  15. #define QD3D_h
  16.  
  17. #include <stdio.h>
  18.  
  19. /******************************************************************************
  20.  **                                                                             **
  21.  **                                Porting Control                                 **
  22.  **                                                                             **
  23.  *****************************************************************************/
  24.  
  25. /*
  26.  *  NOTE:  To compile on a Unix workstation (assumes X11 window system):
  27.  *                1. Add to compiler command line: "-DOS_MACINTOSH=0"
  28.  *                2. Add "-DOS_UNIX=1"
  29.  *                3. Add "-DWINDOW_SYSTEM_X11=1"
  30.  */
  31.  
  32. #if defined(_WIN32) || defined(_WINDOWS)
  33.     #define OS_MACINTOSH                0
  34.     #define OS_WIN32                    1
  35.     #define OS_UNIX                        0
  36.     #define OS_NEXT                        0
  37.  
  38.     #define WINDOW_SYSTEM_MACINTOSH        0
  39.     #define WINDOW_SYSTEM_WIN32            1
  40.     #define WINDOW_SYSTEM_X11            0
  41.     #define WINDOW_SYSTEM_NEXT            0
  42.  
  43. #elif defined(NeXT) && NeXT
  44.     #define OS_MACINTOSH                0
  45.     #define OS_WIN32                    0
  46.     #define OS_UNIX                        0
  47.     #define OS_NEXT                        1
  48.     
  49.     #define WINDOW_SYSTEM_MACINTOSH        0
  50.     #define WINDOW_SYSTEM_WIN32            0
  51.     #define WINDOW_SYSTEM_X11            0
  52.     #define WINDOW_SYSTEM_NEXT            1
  53.  
  54. #elif !defined(OS_MACINTOSH)
  55.     #define OS_MACINTOSH                1
  56.     #define OS_WIN32                    0
  57.     #define OS_UNIX                        0
  58.     #define OS_NEXT                        0
  59.  
  60.     #define WINDOW_SYSTEM_MACINTOSH        1
  61.     #define WINDOW_SYSTEM_WIN32            0
  62.     #define WINDOW_SYSTEM_X11            0
  63.     #define WINDOW_SYSTEM_NEXT            0
  64.  
  65.     #if defined(__MRC__) || defined(__SC__) || defined(__MWERKS__)
  66.          #define PRAGMA_ONCE                1
  67.     #else
  68.          #define PRAGMA_ONCE                0
  69.     #endif  /* defined(__MRC__) || defined(__SC__) || defined(__MWERKS__)  */
  70.  
  71.     /*
  72.      *  Set required compiler options (if possible):
  73.      *   1. enums must always be ints in QD3D and in applications;
  74.      *      this consistency is required to prevent misinterpretation
  75.      *      of an app's enum values by an API; it is also required for
  76.      *      compliance with ANSI
  77.      *   2. alignment of longs, floats, and pointers in structures
  78.      *      is on long boundaries for PowerPC
  79.      */
  80.     #if defined(__xlc__) || defined(__XLC121__)
  81.         #pragma options enum=int
  82.         #pragma options align=power
  83.     #elif defined(__MWERKS__)
  84.         #pragma enumsalwaysint on
  85.         #pragma options align=native
  86.     #elif defined(__MRC__) || defined(__SC__)
  87.         #if __option(pack_enums)
  88.             #define PRAGMA_ENUM_RESET_QD3D 1
  89.         #endif
  90.         #pragma options(!pack_enums)
  91.         #pragma options align=power
  92.     #endif
  93.     
  94.     #if 0    /* moved to Gestalt.h */
  95.     enum {
  96.         gestaltQD3D                = 'qd3d',
  97.         gestaltQD3DVersion        = 'q3v ',
  98.         gestaltQD3DNotPresent    = 0,
  99.         gestaltQD3DAvailable    = 1
  100.     };
  101.     #endif 
  102.     
  103. #endif  /*  OS_MACINTOSH  */
  104.  
  105. #if defined(PRAGMA_ONCE) && PRAGMA_ONCE
  106.     #pragma once
  107. #endif  /*  PRAGMA_ONCE  */ 
  108.  
  109.  
  110. #ifdef __cplusplus
  111. extern "C" {
  112. #endif    /* __cplusplus */
  113.  
  114.  
  115. /******************************************************************************
  116.  **                                                                             **
  117.  **                                Export Control                                 **
  118.  **                                                                             **
  119.  *****************************************************************************/
  120.  
  121. #if defined(_MSC_VER)    /* Microsoft Visual C */
  122.     #if defined(WIN32_EXPORTING)    /* define when building DLL */
  123.         #define QD3D_EXPORT __declspec( dllexport )     
  124.         #define QD3D_CALL    
  125.         #define QD3D_CALLBACK    
  126.     #else
  127.         #define QD3D_EXPORT
  128.         #define QD3D_CALL    __cdecl
  129.         #define QD3D_CALLBACK    __cdecl    
  130.     #endif /* WIN32_EXPORTING */
  131. #else
  132.     #define QD3D_EXPORT
  133.     #define QD3D_CALL    
  134.     #define QD3D_CALLBACK    
  135. #endif  /*  _MSC_VER  */
  136.  
  137.  
  138. /******************************************************************************
  139.  **                                                                             **
  140.  **                                NULL definition                                 **
  141.  **                                                                             **
  142.  *****************************************************************************/
  143.  
  144. #ifndef NULL
  145.     #error NULL is undefined.
  146. #endif /* NULL */
  147.  
  148.  
  149. /******************************************************************************
  150.  **                                                                             **
  151.  **                                    Objects                                     **
  152.  **                                                                             **
  153.  *****************************************************************************/
  154. /*
  155.  * Everything in QuickDraw 3D is an OBJECT: a bunch of data with a type,
  156.  * deletion, duplication, and i/o methods.
  157.  */
  158. typedef long                    TQ3ObjectType;
  159.  
  160. typedef struct TQ3ObjectPrivate    *TQ3Object;
  161.  
  162. /*
  163.  * There are four subclasses of OBJECT:
  164.  *    an ELEMENT, which is data that is placed in a SET
  165.  *    a SHAREDOBJECT, which is reference-counted data that is shared
  166.  *    VIEWs, which maintain state information for an image
  167.  *    a PICK, which used to query a VIEW
  168.  */
  169. typedef TQ3Object                TQ3ElementObject;
  170. typedef TQ3Object                TQ3SharedObject;
  171. typedef TQ3Object                TQ3ViewObject;
  172. typedef TQ3Object                TQ3PickObject;
  173.  
  174. /*
  175.  * There are several types of SharedObjects:
  176.  *    RENDERERs, which paint to a drawContext
  177.  *    DRAWCONTEXTs, which are an interface to a device 
  178.  *    SETs, which maintains "mathematical sets" of ELEMENTs
  179.  *    FILEs, which maintain state information for a metafile
  180.  *    SHAPEs, which affect the state of the View
  181.  *    SHAPEPARTs, which contain geometry-specific data about a picking hit
  182.  *    CONTROLLERSTATEs, which hold state of the output channels for a CONTROLLER
  183.  *    TRACKERs, which represent a position and orientation in the user interface
  184.  *  STRINGs, which are abstractions of text string data.
  185.  *    STORAGE, which is an abstraction for stream-based data storage (files, 
  186.  *        memory)
  187.  *    TEXTUREs, for sharing bitmap information for TEXTURESHADERS
  188.  *    VIEWHINTs, which specifies viewing preferences in FILEs
  189.  */
  190. typedef TQ3SharedObject            TQ3RendererObject;
  191. typedef TQ3SharedObject            TQ3DrawContextObject;
  192. typedef TQ3SharedObject            TQ3SetObject;
  193. typedef TQ3SharedObject            TQ3FileObject;
  194. typedef TQ3SharedObject            TQ3ShapeObject;
  195. typedef TQ3SharedObject            TQ3ShapePartObject;
  196. typedef TQ3SharedObject            TQ3ControllerStateObject;
  197. typedef TQ3SharedObject            TQ3TrackerObject;
  198. typedef TQ3SharedObject            TQ3StringObject;
  199. typedef TQ3SharedObject            TQ3StorageObject;
  200. typedef TQ3SharedObject            TQ3TextureObject;
  201. typedef TQ3SharedObject            TQ3ViewHintsObject;
  202.  
  203.  
  204. /*
  205.  * There is one types of SET:
  206.  *    ATTRIBUTESETs, which contain ATTRIBUTEs which are inherited 
  207.  */
  208. typedef TQ3SetObject                TQ3AttributeSet;
  209.  
  210. /*
  211.  * There are many types of SHAPEs:
  212.  *    LIGHTs, which affect how the RENDERER draws 3-D cues
  213.  *    CAMERAs, which affects the location and orientation of the RENDERER in 
  214.  *        space
  215.  *    GROUPs, which may contain any number of SHARED OBJECTS
  216.  *    GEOMETRYs, which are representations of three-dimensional data
  217.  *    SHADERs, which affect how colors are drawn on a geometry
  218.  *    STYLEs, which affect how the RENDERER paints to the DRAWCONTEXT
  219.  *    TRANSFORMs, which affect the coordinate system in the VIEW
  220.  *    REFERENCEs, which are references to objects in FILEs
  221.  *  UNKNOWN, which hold unknown objects read from a metafile.
  222.  */
  223. typedef TQ3ShapeObject            TQ3GroupObject;
  224. typedef TQ3ShapeObject            TQ3GeometryObject;
  225. typedef TQ3ShapeObject            TQ3ShaderObject;
  226. typedef TQ3ShapeObject            TQ3StyleObject;
  227. typedef TQ3ShapeObject            TQ3TransformObject;
  228. typedef TQ3ShapeObject            TQ3LightObject;
  229. typedef TQ3ShapeObject            TQ3CameraObject;
  230. typedef TQ3ShapeObject            TQ3UnknownObject;
  231. typedef TQ3ShapeObject            TQ3ReferenceObject;
  232.  
  233. /*
  234.  * For now, there is only one type of SHAPEPARTs:
  235.  *    MESHPARTs, which describe some part of a mesh
  236.  */
  237. typedef TQ3ShapePartObject        TQ3MeshPartObject;
  238.  
  239. /*
  240.  * There are three types of MESHPARTs:
  241.  *    MESHFACEPARTs, which describe a face of a mesh
  242.  *    MESHEDGEPARTs, which describe a edge of a mesh
  243.  *    MESHVERTEXPARTs, which describe a vertex of a mesh
  244.  */
  245. typedef TQ3MeshPartObject        TQ3MeshFacePartObject;
  246. typedef TQ3MeshPartObject        TQ3MeshEdgePartObject;
  247. typedef TQ3MeshPartObject        TQ3MeshVertexPartObject;
  248.  
  249. /*
  250.  * A DISPLAY Group can be drawn to a view
  251.  */
  252. typedef TQ3GroupObject            TQ3DisplayGroupObject;
  253.  
  254. /*
  255.  * There are many types of SHADERs:
  256.  *    SURFACESHADERs, which affect how the surface of a geometry is painted
  257.  *    ILLUMINATIONSHADERs, which affect how lights affect the color of a surface
  258.  */
  259. typedef TQ3ShaderObject            TQ3SurfaceShaderObject;
  260. typedef TQ3ShaderObject            TQ3IlluminationShaderObject;
  261.  
  262. /*
  263.  * A handle to an object in a group
  264.  */
  265. typedef struct TQ3GroupPositionPrivate    *TQ3GroupPosition;
  266.  
  267. /* 
  268.  * TQ3ObjectClassNameString is used for the class name of an object
  269.  */
  270. enum {
  271.     kQ3StringMaximumLength = 1024
  272. };
  273.  
  274. typedef char TQ3ObjectClassNameString[kQ3StringMaximumLength];
  275.  
  276.  
  277. /******************************************************************************
  278.  **                                                                             **
  279.  **                            Client/Server Things                             **
  280.  **                                                                             **
  281.  *****************************************************************************/
  282.  
  283. typedef void *TQ3ControllerRef;
  284.  
  285.  
  286. /******************************************************************************
  287.  **                                                                             **
  288.  **                            Flags and Switches                                 **
  289.  **                                                                             **
  290.  *****************************************************************************/
  291.  
  292. typedef enum TQ3Boolean {
  293.     kQ3False,
  294.     kQ3True
  295. } TQ3Boolean;
  296.  
  297. typedef enum TQ3Switch {
  298.     kQ3Off,
  299.     kQ3On
  300. } TQ3Switch;
  301.  
  302. typedef enum TQ3Status {
  303.     kQ3Failure,
  304.     kQ3Success
  305. } TQ3Status;
  306.  
  307. typedef enum TQ3Axis {
  308.     kQ3AxisX,
  309.     kQ3AxisY,
  310.     kQ3AxisZ
  311. } TQ3Axis;
  312.  
  313. typedef enum TQ3PixelType {
  314.     kQ3PixelTypeRGB32        = 0,    /* Alpha:8 (ignored), R:8, G:8, B:8    */
  315.     kQ3PixelTypeARGB32        = 1,    /* Alpha:8, R:8, G:8, B:8             */
  316.     kQ3PixelTypeRGB16        = 2,    /* Alpha:1 (ignored), R:5, G:5, B:5    */
  317.     kQ3PixelTypeARGB16        = 3        /* Alpha:1, R:5, G:5, B:5             */
  318. #if defined(WINDOW_SYSTEM_WIN32) && WINDOW_SYSTEM_WIN32
  319.     ,
  320.     kQ3PixelTypeRGB16_565    = 4,    /* 16 bits/pixel, R:5, G:6, B:5        */
  321.     kQ3PixelTypeRGB24        = 5        /* 24 bits/pixel, R:8, G:8, B:8        */
  322. #endif /* WINDOW_SYSTEM_WIN32 */
  323. } TQ3PixelType;
  324.  
  325. typedef enum TQ3Endian{
  326.     kQ3EndianBig,
  327.     kQ3EndianLittle
  328. } TQ3Endian;
  329.  
  330. typedef enum TQ3EndCapMasks {
  331.     kQ3EndCapNone            = 0,
  332.     kQ3EndCapMaskTop        = 1 << 0,
  333.     kQ3EndCapMaskBottom        = 1 << 1,
  334.     kQ3EndCapMaskInterior    = 1 << 2
  335. } TQ3EndCapMasks;
  336.  
  337. typedef unsigned long TQ3EndCap;
  338.  
  339. enum {
  340.     kQ3ArrayIndexNULL = ~0
  341. };
  342.  
  343.  
  344. /******************************************************************************
  345.  **                                                                             **
  346.  **                        Point and Vector Definitions                         **
  347.  **                                                                             **
  348.  *****************************************************************************/
  349.  
  350. typedef struct TQ3Vector2D {
  351.     float        x;
  352.     float        y;
  353. } TQ3Vector2D;
  354.  
  355. typedef struct TQ3Vector3D {
  356.     float         x;
  357.     float        y;
  358.     float        z;
  359. } TQ3Vector3D;
  360.  
  361. typedef struct TQ3Point2D {
  362.     float        x;
  363.     float        y;
  364. } TQ3Point2D;
  365.  
  366. typedef struct TQ3Point3D {
  367.     float         x;
  368.     float        y;
  369.     float        z;
  370. } TQ3Point3D;
  371.  
  372. typedef struct TQ3RationalPoint4D {
  373.     float         x;
  374.     float        y;
  375.     float        z;
  376.     float        w;
  377. } TQ3RationalPoint4D;
  378.  
  379. typedef struct TQ3RationalPoint3D {
  380.     float        x;
  381.     float        y;
  382.     float        w;
  383. } TQ3RationalPoint3D;
  384.  
  385.  
  386. /******************************************************************************
  387.  **                                                                             **
  388.  **                                Quaternion                                     **
  389.  **                                                                             **
  390.  *****************************************************************************/
  391.  
  392. typedef struct TQ3Quaternion {
  393.     float        w;
  394.     float        x;
  395.     float        y;
  396.     float        z;
  397. } TQ3Quaternion;
  398.  
  399.  
  400. /******************************************************************************
  401.  **                                                                             **
  402.  **                                Ray Definition                                 **
  403.  **                                                                             **
  404.  *****************************************************************************/
  405.  
  406. typedef struct TQ3Ray3D {
  407.     TQ3Point3D        origin;
  408.     TQ3Vector3D        direction;
  409. } TQ3Ray3D;
  410.  
  411.  
  412. /******************************************************************************
  413.  **                                                                             **
  414.  **                        Parameterization Data Structures                     **
  415.  **                                                                             **
  416.  *****************************************************************************/
  417.  
  418. typedef struct TQ3Param2D {
  419.     float            u;
  420.     float            v;
  421. } TQ3Param2D;
  422.  
  423. typedef struct TQ3Param3D {
  424.     float            u;
  425.     float            v;
  426.     float            w;
  427. } TQ3Param3D;
  428.  
  429. typedef struct TQ3Tangent2D {
  430.     TQ3Vector3D        uTangent;
  431.     TQ3Vector3D        vTangent;
  432. } TQ3Tangent2D;
  433.  
  434. typedef struct TQ3Tangent3D {
  435.     TQ3Vector3D        uTangent;
  436.     TQ3Vector3D        vTangent;
  437.     TQ3Vector3D        wTangent;
  438. } TQ3Tangent3D;
  439.  
  440.  
  441. /******************************************************************************
  442.  **                                                                             **
  443.  **                        Polar and Spherical Coordinates                         **
  444.  **                                                                             **
  445.  *****************************************************************************/
  446.  
  447.  typedef struct TQ3PolarPoint {
  448.      float        r;
  449.      float        theta;
  450.   } TQ3PolarPoint;
  451.  
  452.  typedef struct TQ3SphericalPoint {
  453.      float        rho;
  454.      float        theta;
  455.      float        phi;
  456.  } TQ3SphericalPoint;
  457.  
  458.  
  459. /******************************************************************************
  460.  **                                                                             **
  461.  **                            Color Definition                                 **
  462.  **                                                                             **
  463.  *****************************************************************************/
  464.  
  465. typedef struct TQ3ColorRGB {
  466.     float             r;
  467.     float            g;
  468.     float            b;
  469. } TQ3ColorRGB;
  470.  
  471.  
  472. typedef struct TQ3ColorARGB {
  473.     float             a;
  474.     float             r;
  475.     float            g;
  476.     float            b;
  477. } TQ3ColorARGB;
  478.  
  479.  
  480. /******************************************************************************
  481.  **                                                                             **
  482.  **                                    Vertices                                 **
  483.  **                                                                             **
  484.  *****************************************************************************/
  485.  
  486. typedef struct TQ3Vertex3D {
  487.     TQ3Point3D            point;
  488.     TQ3AttributeSet        attributeSet;
  489. }  TQ3Vertex3D;
  490.  
  491.  
  492. /******************************************************************************
  493.  **                                                                             **
  494.  **                                    Matrices                                 **
  495.  **                                                                             **
  496.  *****************************************************************************/
  497.  
  498. typedef struct TQ3Matrix3x3 {
  499.     float    value[3][3];
  500. } TQ3Matrix3x3;
  501.  
  502. typedef struct TQ3Matrix4x4 {
  503.     float    value[4][4];
  504. } TQ3Matrix4x4;
  505.  
  506.  
  507.  
  508.  
  509. /******************************************************************************
  510.  **                                                                             **
  511.  **                                Bitmap/Pixmap                                 **
  512.  **                                                                             **
  513.  *****************************************************************************/
  514.  
  515. typedef struct TQ3Pixmap {
  516.     void                *image;
  517.     unsigned long        width;
  518.     unsigned long        height;
  519.     unsigned long        rowBytes;
  520.     unsigned long        pixelSize;    /* MUST be 16 or 32 to use with the         */
  521.                                     /* Interactive Renderer on Mac OS         */
  522.     TQ3PixelType        pixelType;
  523.     TQ3Endian            bitOrder;
  524.     TQ3Endian            byteOrder;
  525. } TQ3Pixmap;
  526.  
  527. typedef struct TQ3StoragePixmap {
  528.     TQ3StorageObject    image;
  529.     unsigned long        width;
  530.     unsigned long        height;
  531.     unsigned long        rowBytes;
  532.     unsigned long        pixelSize;    /* MUST be 16 or 32 to use with the     */
  533.                                     /* Interactive Renderer on Mac OS        */
  534.     TQ3PixelType        pixelType;
  535.     TQ3Endian            bitOrder;
  536.     TQ3Endian            byteOrder;
  537. } TQ3StoragePixmap;
  538.  
  539. typedef struct TQ3Bitmap {
  540.     unsigned char        *image;
  541.     unsigned long        width;
  542.     unsigned long        height;
  543.     unsigned long        rowBytes;
  544.     TQ3Endian            bitOrder;
  545. } TQ3Bitmap;
  546.  
  547. typedef struct TQ3MipmapImage {        /* An image for use as a texture mipmap  */
  548.     unsigned long        width;        /* Width of mipmap, must be power of 2   */
  549.     unsigned long        height;        /* Height of mipmap, must be power of 2  */
  550.     unsigned long        rowBytes;    /* Rowbytes of mipmap                    */
  551.     unsigned long        offset;        /* Offset from image base to this mipmap */
  552. } TQ3MipmapImage;
  553.  
  554. typedef struct TQ3Mipmap {
  555.     TQ3StorageObject    image;        /* Data containing the texture map and     */
  556.                                     /* if (useMipmapping==kQ3True) the         */
  557.                                     /* mipmap data                             */
  558.     TQ3Boolean            useMipmapping;/* True if mipmapping should be used     */
  559.                                     /* and all mipmaps have been provided   */
  560.     TQ3PixelType        pixelType;
  561.     TQ3Endian            bitOrder;
  562.     TQ3Endian            byteOrder;
  563.     unsigned long        reserved;    /* leave NULL for next version */
  564.     TQ3MipmapImage        mipmaps[32];/* The actual number of mipmaps is         */
  565.                                     /* determined from the size of the         */
  566.                                     /* first mipmap                            */
  567. } TQ3Mipmap;
  568.  
  569.  
  570. /******************************************************************************
  571.  **                                                                             **
  572.  **                        Higher dimension quantities                             **
  573.  **                                                                             **
  574.  *****************************************************************************/
  575.  
  576. typedef struct TQ3Area {
  577.     TQ3Point2D             min;
  578.     TQ3Point2D             max;
  579. } TQ3Area;
  580.  
  581. typedef struct TQ3PlaneEquation {
  582.     TQ3Vector3D            normal;
  583.     float                constant;
  584. } TQ3PlaneEquation;
  585.  
  586. typedef struct TQ3BoundingBox {
  587.     TQ3Point3D             min;
  588.     TQ3Point3D             max;
  589.     TQ3Boolean            isEmpty;
  590. } TQ3BoundingBox;
  591.  
  592. typedef struct TQ3BoundingSphere {
  593.     TQ3Point3D            origin;
  594.     float                radius;
  595.     TQ3Boolean            isEmpty;
  596. } TQ3BoundingSphere;
  597.  
  598. /*
  599.  *    The TQ3ComputeBounds flag passed to StartBoundingBox or StartBoundingSphere
  600.  *    calls in the View. It's a hint to the system as to how it should 
  601.  *    compute the bbox of a shape:
  602.  *
  603.  *    kQ3ComputeBoundsExact:    
  604.  *        Vertices of shapes are transformed into world space and
  605.  *        the world space bounding box is computed from them.  Slow!
  606.  *    
  607.  *    kQ3ComputeBoundsApproximate: 
  608.  *        A local space bounding box is computed from a shape's
  609.  *        vertices.  This bbox is then transformed into world space,
  610.  *        and its bounding box is taken as the shape's approximate
  611.  *        bbox.  Fast but the bbox is larger than optimal.
  612.  */
  613. typedef enum TQ3ComputeBounds {
  614.     kQ3ComputeBoundsExact,
  615.     kQ3ComputeBoundsApproximate
  616. } TQ3ComputeBounds;
  617.  
  618.  
  619. /******************************************************************************
  620.  **                                                                             **
  621.  **                            Object System Types                                 **
  622.  **                                                                             **
  623.  *****************************************************************************/
  624.  
  625.  
  626.  
  627. typedef struct TQ3ObjectClassPrivate        *TQ3XObjectClass;
  628.  
  629. typedef unsigned long                         TQ3XMethodType;
  630.  
  631. /*
  632.  *  Object methods
  633.  */
  634. #define kQ3XMethodTypeObjectUnregister        Q3_METHOD_TYPE('u','n','r','g')
  635.  
  636. /* 
  637.  *  Return true from the metahandler if this 
  638.  *  object can be submitted in a rendering loop 
  639.  */
  640. #define kQ3XMethodTypeObjectIsDrawable        Q3_METHOD_TYPE('i','s','d','r')    
  641.  
  642. typedef void (QD3D_CALLBACK *TQ3XFunctionPointer)(
  643.     void);
  644.  
  645. typedef TQ3XFunctionPointer (QD3D_CALLBACK *TQ3XMetaHandler)(
  646.     TQ3XMethodType        methodType);
  647.  
  648. /*
  649.  * MetaHandler:
  650.  *        When you give a metahandler to QuickDraw 3D, it is called multiple 
  651.  *        times to build method tables, and then is thrown away. You are 
  652.  *        guaranteed that your metahandler will never be called again after a 
  653.  *        call that was passed a metahandler returns.
  654.  *
  655.  *        Your metahandler should contain a switch on the methodType passed to it
  656.  *        and should return the corresponding method as an TQ3XFunctionPointer.
  657.  *
  658.  *        IMPORTANT: A metaHandler MUST always "return" a value. If you are
  659.  *        passed a methodType that you do not understand, ALWAYS return NULL.
  660.  *
  661.  *        These types here are prototypes of how your functions should look.
  662.  */
  663. typedef TQ3Status (QD3D_CALLBACK *TQ3XObjectUnregisterMethod)(
  664.     TQ3XObjectClass        objectClass);
  665.     
  666. /*
  667.  * See QD3DIO.h for the IO method types: 
  668.  *        ObjectReadData, ObjectTraverse, ObjectWrite
  669.  */
  670.  
  671.  
  672. /******************************************************************************
  673.  **                                                                             **
  674.  **                                Set Types                                     **
  675.  **                                                                             **
  676.  *****************************************************************************/
  677.  
  678. typedef long                    TQ3ElementType;
  679.  
  680. #define kQ3ElementTypeNone        0
  681. #define kQ3ElementTypeUnknown    32
  682. #define kQ3ElementTypeSet        33
  683.  
  684. /* 
  685.  *    kQ3ElementTypeUnknown is a TQ3Object. 
  686.  *    
  687.  *        Do Q3Set_Add(s, ..., &obj) or Q3Set_Get(s, ..., &obj);
  688.  *        
  689.  *        Note that the object is always referenced when copying around. 
  690.  *        
  691.  *        Generally, it is an Unknown object, a Group of Unknown objects, or a 
  692.  *        group of other "objects" which have been found in the metafile and
  693.  *        have no attachment method to their parent. Be prepared to handle
  694.  *        any or all of these cases if you actually access the set on a shape.
  695.  *
  696.  *    kQ3ElementTypeSet is a TQ3SetObject. 
  697.  *    
  698.  *        Q3Shape_GetSet(s,&o) is eqivalent to 
  699.  *            Q3Shape_GetElement(s, kQ3ElementTypeSet, &o)
  700.  *            
  701.  *        Q3Shape_SetSet(s,o)  is eqivalent to 
  702.  *            Q3Shape_SetElement(s, kQ3ElementTypeSet, &o)
  703.  *    
  704.  *        Note that the object is always referenced when copying around. 
  705.  *        
  706.  *    See the note below about the Set and Shape changes.
  707.  */
  708.  
  709. /******************************************************************************
  710.  **                                                                             **
  711.  **                            Object System Macros                             **
  712.  **                                                                             **
  713.  *****************************************************************************/
  714.  
  715. #define Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d)         \
  716.             ((const unsigned long)                     \
  717.             ((const unsigned long) (a) << 24) |     \
  718.             ((const unsigned long) (b) << 16) |        \
  719.             ((const unsigned long) (c) << 8)  |     \
  720.             ((const unsigned long) (d)))
  721.  
  722. #define Q3_OBJECT_TYPE(a,b,c,d) \
  723.     ((TQ3ObjectType) Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d))
  724.  
  725. #define Q3_METHOD_TYPE(a,b,c,d) \
  726.     ((TQ3XMethodType) Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d))
  727.  
  728.  
  729.  
  730. /******************************************************************************
  731.  **                                                                             **
  732.  **                                Object Types                                 **
  733.  **                                                                             **
  734.  *****************************************************************************/
  735.  
  736. /*
  737.  * Note:    a call to Q3Foo_GetType will return a value kQ3FooTypeBar
  738.  *            e.g. Q3Shared_GetType(object) returns kQ3SharedTypeShape, etc.
  739.  */
  740. #define kQ3ObjectTypeInvalid                            0L
  741. #define kQ3ObjectTypeView                                Q3_OBJECT_TYPE('v','i','e','w')
  742. #define kQ3ObjectTypeElement                            Q3_OBJECT_TYPE('e','l','m','n')
  743.     #define kQ3ElementTypeAttribute                        Q3_OBJECT_TYPE('e','a','t','t')
  744. #define kQ3ObjectTypePick                                Q3_OBJECT_TYPE('p','i','c','k')
  745.     #define kQ3PickTypeWindowPoint                        Q3_OBJECT_TYPE('p','k','w','p')
  746.     #define kQ3PickTypeWindowRect                        Q3_OBJECT_TYPE('p','k','w','r')
  747. #define kQ3ObjectTypeShared                                Q3_OBJECT_TYPE('s','h','r','d')
  748.     #define kQ3SharedTypeRenderer                        Q3_OBJECT_TYPE('r','d','d','r')
  749.         #define kQ3RendererTypeWireFrame                Q3_OBJECT_TYPE('w','r','f','r')
  750.         #define kQ3RendererTypeGeneric                    Q3_OBJECT_TYPE('g','n','r','r')
  751.         #define kQ3RendererTypeInteractive                Q3_OBJECT_TYPE('c','t','w','n')
  752.     #define kQ3SharedTypeShape                            Q3_OBJECT_TYPE('s','h','a','p')
  753.         #define kQ3ShapeTypeGeometry                    Q3_OBJECT_TYPE('g','m','t','r')
  754.             #define kQ3GeometryTypeBox                    Q3_OBJECT_TYPE('b','o','x',' ')
  755.             #define kQ3GeometryTypeGeneralPolygon        Q3_OBJECT_TYPE('g','p','g','n')
  756.             #define kQ3GeometryTypeLine                    Q3_OBJECT_TYPE('l','i','n','e')
  757.             #define kQ3GeometryTypeMarker                Q3_OBJECT_TYPE('m','r','k','r')
  758.             #define kQ3GeometryTypePixmapMarker            Q3_OBJECT_TYPE('m','r','k','p')
  759.             #define kQ3GeometryTypeMesh                    Q3_OBJECT_TYPE('m','e','s','h')
  760.             #define kQ3GeometryTypeNURBCurve            Q3_OBJECT_TYPE('n','r','b','c')
  761.             #define kQ3GeometryTypeNURBPatch            Q3_OBJECT_TYPE('n','r','b','p')
  762.             #define kQ3GeometryTypePoint                Q3_OBJECT_TYPE('p','n','t',' ')
  763.             #define kQ3GeometryTypePolygon                Q3_OBJECT_TYPE('p','l','y','g')
  764.             #define kQ3GeometryTypePolyLine                Q3_OBJECT_TYPE('p','l','y','l')
  765.             #define kQ3GeometryTypeTriangle                Q3_OBJECT_TYPE('t','r','n','g')
  766.             #define kQ3GeometryTypeTriGrid                Q3_OBJECT_TYPE('t','r','i','g')
  767.             #define kQ3GeometryTypeCone                    Q3_OBJECT_TYPE('c','o','n','e')
  768.             #define kQ3GeometryTypeCylinder                Q3_OBJECT_TYPE('c','y','l','n')
  769.             #define kQ3GeometryTypeDisk                    Q3_OBJECT_TYPE('d','i','s','k')
  770.             #define kQ3GeometryTypeEllipse                Q3_OBJECT_TYPE('e','l','p','s')
  771.             #define kQ3GeometryTypeEllipsoid            Q3_OBJECT_TYPE('e','l','p','d')
  772.             #define kQ3GeometryTypePolyhedron            Q3_OBJECT_TYPE('p','l','h','d')
  773.             #define kQ3GeometryTypeTorus                Q3_OBJECT_TYPE('t','o','r','s')
  774.             #define kQ3GeometryTypeTriMesh                Q3_OBJECT_TYPE('t','m','s','h')
  775.         #define kQ3ShapeTypeShader                        Q3_OBJECT_TYPE('s','h','d','r')
  776.             #define kQ3ShaderTypeSurface                Q3_OBJECT_TYPE('s','u','s','h')
  777.                 #define kQ3SurfaceShaderTypeTexture        Q3_OBJECT_TYPE('t','x','s','u')
  778.             #define kQ3ShaderTypeIllumination            Q3_OBJECT_TYPE('i','l','s','h')
  779.                 #define kQ3IlluminationTypePhong        Q3_OBJECT_TYPE('p','h','i','l')
  780.                 #define kQ3IlluminationTypeLambert        Q3_OBJECT_TYPE('l','m','i','l')
  781.                 #define kQ3IlluminationTypeNULL            Q3_OBJECT_TYPE('n','u','i','l')
  782.         #define kQ3ShapeTypeStyle                        Q3_OBJECT_TYPE('s','t','y','l')
  783.             #define kQ3StyleTypeBackfacing                Q3_OBJECT_TYPE('b','c','k','f')
  784.             #define kQ3StyleTypeInterpolation            Q3_OBJECT_TYPE('i','n','t','p')
  785.             #define kQ3StyleTypeFill                    Q3_OBJECT_TYPE('f','i','s','t')
  786.             #define kQ3StyleTypePickID                    Q3_OBJECT_TYPE('p','k','i','d')
  787.             #define kQ3StyleTypeReceiveShadows            Q3_OBJECT_TYPE('r','c','s','h')
  788.             #define kQ3StyleTypeHighlight                Q3_OBJECT_TYPE('h','i','g','h')
  789.             #define kQ3StyleTypeSubdivision                Q3_OBJECT_TYPE('s','b','d','v')
  790.             #define kQ3StyleTypeOrientation                Q3_OBJECT_TYPE('o','f','d','r')
  791.             #define kQ3StyleTypePickParts                Q3_OBJECT_TYPE('p','k','p','t')
  792.             #define kQ3StyleTypeAntiAlias                Q3_OBJECT_TYPE('a','n','t','i')
  793.         #define kQ3ShapeTypeTransform                    Q3_OBJECT_TYPE('x','f','r','m')
  794.             #define kQ3TransformTypeMatrix                Q3_OBJECT_TYPE('m','t','r','x')
  795.             #define kQ3TransformTypeScale                Q3_OBJECT_TYPE('s','c','a','l')
  796.             #define kQ3TransformTypeTranslate            Q3_OBJECT_TYPE('t','r','n','s')
  797.             #define kQ3TransformTypeRotate                Q3_OBJECT_TYPE('r','o','t','t')
  798.             #define kQ3TransformTypeRotateAboutPoint     Q3_OBJECT_TYPE('r','t','a','p')
  799.             #define kQ3TransformTypeRotateAboutAxis     Q3_OBJECT_TYPE('r','t','a','a')
  800.             #define kQ3TransformTypeQuaternion            Q3_OBJECT_TYPE('q','t','r','n')
  801.             #define kQ3TransformTypeReset                Q3_OBJECT_TYPE('r','s','e','t')
  802.         #define kQ3ShapeTypeLight                        Q3_OBJECT_TYPE('l','g','h','t')
  803.             #define kQ3LightTypeAmbient                    Q3_OBJECT_TYPE('a','m','b','n')
  804.             #define kQ3LightTypeDirectional                Q3_OBJECT_TYPE('d','r','c','t')
  805.             #define kQ3LightTypePoint                    Q3_OBJECT_TYPE('p','n','t','l')
  806.             #define kQ3LightTypeSpot                    Q3_OBJECT_TYPE('s','p','o','t')
  807.         #define kQ3ShapeTypeCamera                        Q3_OBJECT_TYPE('c','m','r','a')
  808.             #define kQ3CameraTypeOrthographic            Q3_OBJECT_TYPE('o','r','t','h')
  809.             #define kQ3CameraTypeViewPlane                Q3_OBJECT_TYPE('v','w','p','l')
  810.             #define kQ3CameraTypeViewAngleAspect        Q3_OBJECT_TYPE('v','a','n','a')
  811.     
  812.         #define kQ3ShapeTypeGroup                        Q3_OBJECT_TYPE('g','r','u','p')
  813.             #define kQ3GroupTypeDisplay                    Q3_OBJECT_TYPE('d','s','p','g')
  814.                 #define kQ3DisplayGroupTypeOrdered        Q3_OBJECT_TYPE('o','r','d','g')
  815.                 #define kQ3DisplayGroupTypeIOProxy        Q3_OBJECT_TYPE('i','o','p','x')
  816.             #define kQ3GroupTypeLight                    Q3_OBJECT_TYPE('l','g','h','g')
  817.             #define kQ3GroupTypeInfo                    Q3_OBJECT_TYPE('i','n','f','o')
  818.         #define kQ3ShapeTypeUnknown                        Q3_OBJECT_TYPE('u','n','k','n')
  819.             #define kQ3UnknownTypeText                    Q3_OBJECT_TYPE('u','k','t','x')
  820.             #define kQ3UnknownTypeBinary                Q3_OBJECT_TYPE('u','k','b','n')
  821.         #define kQ3ShapeTypeReference                    Q3_OBJECT_TYPE('r','f','r','n')
  822.             #define kQ3ReferenceTypeExternal            Q3_OBJECT_TYPE('r','f','e','x')
  823.     #define kQ3SharedTypeSet                            Q3_OBJECT_TYPE('s','e','t',' ')
  824.         #define kQ3SetTypeAttribute                        Q3_OBJECT_TYPE('a','t','t','r')
  825.     #define kQ3SharedTypeDrawContext                    Q3_OBJECT_TYPE('d','c','t','x')
  826.         #define kQ3DrawContextTypePixmap                Q3_OBJECT_TYPE('d','p','x','p')
  827.         #if defined(WINDOW_SYSTEM_MACINTOSH) && WINDOW_SYSTEM_MACINTOSH
  828.         #define kQ3DrawContextTypeMacintosh                Q3_OBJECT_TYPE('d','m','a','c')
  829.         #endif  /*  WINDOW_SYSTEM_MACINTOSH  */
  830.         #if defined(WINDOW_SYSTEM_WIN32) && WINDOW_SYSTEM_WIN32
  831.         #define kQ3DrawContextTypeWin32DC                Q3_OBJECT_TYPE('d','w','3','2')
  832.         #define kQ3DrawContextTypeDDSurface                Q3_OBJECT_TYPE('d','d','d','s')
  833.         #endif  /*  WINDOW_SYSTEM_WIN32  */
  834.         #if defined(WINDOW_SYSTEM_X11) && WINDOW_SYSTEM_X11
  835.         #define kQ3DrawContextTypeX11                    Q3_OBJECT_TYPE('d','x','1','1')
  836.         #endif  /*  WINDOW_SYSTEM_X11  */
  837.     #define kQ3SharedTypeTexture                        Q3_OBJECT_TYPE('t','x','t','r')
  838.         #define kQ3TextureTypePixmap                    Q3_OBJECT_TYPE('t','x','p','m')
  839.         #define kQ3TextureTypeMipmap                    Q3_OBJECT_TYPE('t','x','m','m')
  840.     #define kQ3SharedTypeFile                            Q3_OBJECT_TYPE('f','i','l','e')
  841.     #define kQ3SharedTypeStorage                        Q3_OBJECT_TYPE('s','t','r','g')
  842.         #define kQ3StorageTypeMemory                    Q3_OBJECT_TYPE('m','e','m','s')
  843.             #if defined(OS_MACINTOSH) && OS_MACINTOSH
  844.             #define kQ3MemoryStorageTypeHandle            Q3_OBJECT_TYPE('h','n','d','l')
  845.             #endif  /*  OS_MACINTOSH  */
  846.         #define kQ3StorageTypeUnix                        Q3_OBJECT_TYPE('u','x','s','t')
  847.             #define kQ3UnixStorageTypePath                Q3_OBJECT_TYPE('u','n','i','x')
  848.         #if defined(OS_MACINTOSH) && OS_MACINTOSH
  849.         #define kQ3StorageTypeMacintosh                    Q3_OBJECT_TYPE('m','a','c','n')
  850.             #define kQ3MacintoshStorageTypeFSSpec        Q3_OBJECT_TYPE('m','a','c','p')                    
  851.         #endif  /*  OS_MACINTOSH  */
  852.         #if defined(OS_WIN32) && OS_WIN32
  853.         #define kQ3StorageTypeWin32                        Q3_OBJECT_TYPE('w','i','s','t')
  854.         #endif  /*  OS_WIN32  */
  855.     #define kQ3SharedTypeString                            Q3_OBJECT_TYPE('s','t','r','n')
  856.         #define kQ3StringTypeCString                    Q3_OBJECT_TYPE('s','t','r','c')
  857.     #define kQ3SharedTypeShapePart                        Q3_OBJECT_TYPE('s','p','r','t')
  858.         #define kQ3ShapePartTypeMeshPart                Q3_OBJECT_TYPE('s','p','m','h')
  859.             #define kQ3MeshPartTypeMeshFacePart            Q3_OBJECT_TYPE('m','f','a','c')
  860.             #define kQ3MeshPartTypeMeshEdgePart            Q3_OBJECT_TYPE('m','e','d','g')
  861.             #define kQ3MeshPartTypeMeshVertexPart        Q3_OBJECT_TYPE('m','v','t','x')
  862.     #define kQ3SharedTypeControllerState                Q3_OBJECT_TYPE('c','t','s','t')
  863.     #define kQ3SharedTypeTracker                        Q3_OBJECT_TYPE('t','r','k','r')
  864.     #define kQ3SharedTypeViewHints                        Q3_OBJECT_TYPE('v','w','h','n')
  865.     #define kQ3SharedTypeEndGroup                        Q3_OBJECT_TYPE('e','n','d','g')
  866.  
  867.  
  868. /******************************************************************************
  869.  **                                                                             **
  870.  **                            QuickDraw 3D System Routines                     **
  871.  **                                                                             **
  872.  *****************************************************************************/
  873.  
  874. QD3D_EXPORT TQ3Status QD3D_CALL Q3Initialize(
  875.     void);
  876.  
  877. QD3D_EXPORT TQ3Status QD3D_CALL Q3Exit(
  878.     void);
  879.  
  880. QD3D_EXPORT TQ3Boolean QD3D_CALL Q3IsInitialized(
  881.     void);
  882.  
  883. QD3D_EXPORT TQ3Status QD3D_CALL Q3GetVersion(
  884.     unsigned long        *majorRevision,
  885.     unsigned long        *minorRevision);
  886.  
  887. /*
  888.  *  Q3GetReleaseVersion returns the release version number,
  889.  *  in the format of the first four bytes of a 'vers' resource
  890.  *  (e.g. 0x01518000 ==> 1.5.1 release).
  891.  */
  892. QD3D_EXPORT TQ3Status QD3D_CALL Q3GetReleaseVersion(
  893.     unsigned long        *releaseRevision);
  894.  
  895.  
  896. /******************************************************************************
  897.  **                                                                             **
  898.  **                            ObjectClass Routines                             **
  899.  **                                                                             **
  900.  *****************************************************************************/
  901.  
  902.  
  903. /* 
  904.  *  New object system calls to query the object system.
  905.  *
  906.  *  These comments to move to the stubs file before final release, they 
  907.  *  are here for documentation for developers using early seeds.
  908.  */
  909.  
  910. /*
  911.  *  Given a class name as a string return the associated class type for the 
  912.  *  class, may return kQ3Failure if the string representing the class is 
  913.  *  invalid.
  914.  */
  915. QD3D_EXPORT TQ3Status QD3D_CALL Q3ObjectHierarchy_GetTypeFromString(
  916.     TQ3ObjectClassNameString    objectClassString, 
  917.     TQ3ObjectType                 *objectClassType);
  918.     
  919. /*
  920.  *  Given a class type as return the associated string for the class name, 
  921.  *  may return kQ3Failure if the type representing the class is invalid.
  922.  */
  923. QD3D_EXPORT TQ3Status QD3D_CALL Q3ObjectHierarchy_GetStringFromType(
  924.     TQ3ObjectType                objectClassType, 
  925.     TQ3ObjectClassNameString     objectClassString);
  926.  
  927. /* 
  928.  *  Return true if the class with this type is registered, false if not 
  929.  */
  930. QD3D_EXPORT TQ3Boolean QD3D_CALL Q3ObjectHierarchy_IsTypeRegistered(
  931.     TQ3ObjectType                objectClassType);
  932.  
  933. /* 
  934.  *  Return true if the class with this name is registered, false if not 
  935.  */
  936. QD3D_EXPORT TQ3Boolean QD3D_CALL Q3ObjectHierarchy_IsNameRegistered(
  937.     const char                    *objectClassName);
  938.  
  939. /*
  940.  * TQ3SubClassData is used when querying the object system for
  941.  * the subclasses of a particular parent type:
  942.  */
  943. typedef struct TQ3SubClassData {
  944.     unsigned long         numClasses;        /* the # of subclass types found */
  945.                                         /* for a parent class              */
  946.     TQ3ObjectType        *classTypes;    /* an array containing the class */
  947.                                         /* types                         */
  948. } TQ3SubClassData;
  949.  
  950. /*
  951.  *  Given a parent type and an instance of the TQ3SubClassData struct fill
  952.  *  it in with the number and class types of all of the subclasses immediately
  953.  *  below the parent in the class hierarchy.  Return kQ3Success to indicate no
  954.  *  errors occurred, else kQ3Failure.
  955.  *
  956.  *  NOTE:  This function will allocate memory for the classTypes array.  Be 
  957.  *    sure to call Q3ObjectClass_EmptySubClassData to free this memory up.
  958.  */
  959. QD3D_EXPORT TQ3Status QD3D_CALL Q3ObjectHierarchy_GetSubClassData(
  960.     TQ3ObjectType                objectClassType, 
  961.     TQ3SubClassData                *subClassData);
  962.  
  963. /*
  964.  *  Given an instance of the TQ3SubClassData struct free all memory allocated 
  965.  *    by the Q3ObjectClass_GetSubClassData call.
  966.  *
  967.  *  NOTE: This call MUST be made after a call to Q3ObjectClass_GetSubClassData
  968.  *  to avoid memory leaks.
  969.  */
  970. QD3D_EXPORT TQ3Status QD3D_CALL Q3ObjectHierarchy_EmptySubClassData(
  971.     TQ3SubClassData                *subClassData);
  972.  
  973.  
  974. /******************************************************************************
  975.  **                                                                             **
  976.  **                                Object Routines                                 **
  977.  **                                                                             **
  978.  *****************************************************************************/
  979.  
  980. QD3D_EXPORT TQ3Status QD3D_CALL Q3Object_Dispose(
  981.     TQ3Object             object);
  982.     
  983. QD3D_EXPORT TQ3Object QD3D_CALL Q3Object_Duplicate(
  984.     TQ3Object            object);
  985.     
  986. QD3D_EXPORT TQ3Status QD3D_CALL Q3Object_Submit(
  987.     TQ3Object            object,
  988.     TQ3ViewObject        view);
  989.     
  990. QD3D_EXPORT TQ3Boolean QD3D_CALL Q3Object_IsDrawable(
  991.     TQ3Object            object);
  992.  
  993. QD3D_EXPORT TQ3Boolean QD3D_CALL Q3Object_IsWritable(
  994.     TQ3Object            object,
  995.     TQ3FileObject        file);
  996.  
  997.  
  998. /******************************************************************************
  999.  **                                                                             **
  1000.  **                            Object Type Routines                             **
  1001.  **                                                                             **
  1002.  *****************************************************************************/
  1003.  
  1004. QD3D_EXPORT TQ3ObjectType QD3D_CALL Q3Object_GetType(
  1005.     TQ3Object            object);
  1006.  
  1007. QD3D_EXPORT TQ3ObjectType QD3D_CALL Q3Object_GetLeafType(
  1008.     TQ3Object            object);
  1009.  
  1010. QD3D_EXPORT TQ3Boolean QD3D_CALL Q3Object_IsType(
  1011.     TQ3Object            object,
  1012.     TQ3ObjectType        type);
  1013.  
  1014.  
  1015. /******************************************************************************
  1016.  **                                                                             **
  1017.  **                            Shared Object Routines                             **
  1018.  **                                                                             **
  1019.  *****************************************************************************/
  1020.  
  1021. QD3D_EXPORT TQ3ObjectType QD3D_CALL Q3Shared_GetType(
  1022.     TQ3SharedObject     sharedObject);
  1023.  
  1024. QD3D_EXPORT TQ3SharedObject QD3D_CALL Q3Shared_GetReference(
  1025.     TQ3SharedObject     sharedObject);
  1026.  
  1027. /* 
  1028.  *    Q3Shared_IsReferenced
  1029.  *        Returns kQ3True if there is more than one reference to sharedObject.
  1030.  *        Returns kQ3False if there is ONE reference to sharedObject.
  1031.  *    
  1032.  *    This call is intended to allow applications and plug-in objects to delete
  1033.  *    objects of which they hold THE ONLY REFERENCE. This is useful when
  1034.  *    caching objects, etc.
  1035.  *    
  1036.  *    Although many may be tempted, DO NOT DO THIS:
  1037.  *        while (Q3Shared_IsReferenced(foo)) { Q3Object_Dispose(foo); }
  1038.  *    
  1039.  *    Your application will crash and no one will buy it. Chapter 11 is 
  1040.  *    never fun (unless you short the stock). Thanks.
  1041.  */
  1042. QD3D_EXPORT TQ3Boolean QD3D_CALL Q3Shared_IsReferenced(
  1043.     TQ3SharedObject         sharedObject);
  1044.  
  1045. /*
  1046.  *    Q3Shared_GetEditIndex
  1047.  *        Returns the "serial number" of sharedObject. Usefuly for caching 
  1048.  *        object information. Returns 0 on error.
  1049.  *        
  1050.  *        Hold onto this number to determine if an object has changed since you
  1051.  *        last built your caches... To validate, do:
  1052.  *        
  1053.  *        if (Q3Shared_GetEditIndex(foo) == oldFooEditIndex) {
  1054.  *            // Cache is valid
  1055.  *        } else {
  1056.  *            // Cache is invalid
  1057.  *            RebuildSomeSortOfCache(foo);
  1058.  *            oldFooEditIndex = Q3Shared_GetEditIndex(foo);
  1059.  *        }
  1060.  */
  1061. QD3D_EXPORT unsigned long QD3D_CALL Q3Shared_GetEditIndex(
  1062.     TQ3SharedObject         sharedObject);
  1063.  
  1064. /*
  1065.  *    Q3Shared_Edited
  1066.  *        Bumps the "serial number" of sharedObject to a different value. This
  1067.  *        call is intended to be used solely from a plug-in object which is 
  1068.  *        shared. Call this whenever your private instance data changes.
  1069.  *        
  1070.  *        Returns kQ3Failure iff sharedObject is not a shared object, OR
  1071.  *            QuickDraw 3D isn't initialized.
  1072.  */
  1073. QD3D_EXPORT TQ3Status QD3D_CALL Q3Shared_Edited(
  1074.     TQ3SharedObject         sharedObject);
  1075.  
  1076.  
  1077. /******************************************************************************
  1078.  **                                                                             **
  1079.  **                                Shape Routines                                 **
  1080.  **                                                                             **
  1081.  *****************************************************************************/
  1082.  
  1083. /*
  1084.  *    QuickDraw 3D 1.1 Note:
  1085.  *
  1086.  *    Shapes and Sets are now (sort of) polymorphic.
  1087.  *
  1088.  *        You may call Q3Shape_Foo or Q3Set_Foo on a shape or a set.
  1089.  *        The following calls are identical, in implementation:
  1090.  *
  1091.  *            Q3Shape_GetElement            =    Q3Set_Get
  1092.  *            Q3Shape_AddElement            =    Q3Set_Add
  1093.  *            Q3Shape_ContainsElement        =    Q3Set_Contains
  1094.  *            Q3Shape_GetNextElementType    =    Q3Set_GetNextElementType
  1095.  *            Q3Shape_EmptyElements        =    Q3Set_Empty
  1096.  *            Q3Shape_ClearElement        =    Q3Set_Clear
  1097.  *
  1098.  *    All of these calls accept a shape or a set as their first parameter.
  1099.  *
  1100.  *    The Q3Shape_GetSet and Q3ShapeSetSet calls are implemented via a new
  1101.  *    element type kQ3ElementTypeSet. See the note above about 
  1102.  *    kQ3ElementTypeSet;
  1103.  *
  1104.  *    It is important to note that the new Q3Shape_...Element... calls do not
  1105.  *    create a set on a shape and then add the element to it. This data is
  1106.  *    attached directly to the shape. Therefore, it is possible for an element
  1107.  *    to exist on a shape without a set existing on it as well. 
  1108.  *
  1109.  *    In your application, if you attach an element to a shape like this:
  1110.  *        (this isn't checking for errors for simplicity)
  1111.  *
  1112.  *        set = Q3Set_New();
  1113.  *        Q3Set_Add(set, gMyElemType, &data);
  1114.  *        Q3Shape_SetSet(shape, set);
  1115.  *
  1116.  *    You should retrieve it in the same manner:
  1117.  *
  1118.  *        Q3Shape_GetSet(shape, &set);
  1119.  *        if (Q3Set_Contains(set, gMyElemType) == kQ3True) {
  1120.  *            Q3Set_Get(set, gMyElemType, &data);
  1121.  *        }
  1122.  *
  1123.  *    Similarly, if you attach data to a shape with the new calls:
  1124.  *
  1125.  *        Q3Shape_AddElement(shape, gMyElemType, &data);
  1126.  *
  1127.  *    You should retrieve it in the same manner:
  1128.  *
  1129.  *        if (Q3Shape_ContainsElement(set, gMyElemType) == kQ3True) {
  1130.  *            Q3Shape_GetElement(set, gMyElemType, &data);
  1131.  *        }
  1132.  *
  1133.  *    This really becomes an issue when dealing with version 1.0 and version 1.1 
  1134.  *    metafiles.
  1135.  *
  1136.  *    When attempting to find a particular element on a shape, you should
  1137.  *    first check with Q3Shape_GetNextElementType or Q3Shape_GetElement, then,
  1138.  *    Q3Shape_GetSet(s, &set) (or Q3Shape_GetElement(s, kQ3ElementTypeSet, &set))
  1139.  *    and then Q3Shape_GetElement(set, ...).
  1140.  *
  1141.  *    In terms of implementation, Q3Shape_SetSet and Q3Shape_GetSet should only be
  1142.  *    used for sets of information that are shared among multiple shapes.
  1143.  *    
  1144.  *    Q3Shape_AddElement, Q3Shape_GetElement, etc. calls should only be used
  1145.  *    for elements that are unique for a particular shape.
  1146.  *    
  1147.  */
  1148. QD3D_EXPORT TQ3ObjectType QD3D_CALL Q3Shape_GetType(
  1149.     TQ3ShapeObject    shape);
  1150.  
  1151. QD3D_EXPORT TQ3Status QD3D_CALL Q3Shape_GetSet(
  1152.     TQ3ShapeObject    shape,
  1153.     TQ3SetObject    *set);
  1154.  
  1155. QD3D_EXPORT TQ3Status QD3D_CALL Q3Shape_SetSet(
  1156.     TQ3ShapeObject    shape,
  1157.     TQ3SetObject     set);
  1158.  
  1159. QD3D_EXPORT TQ3Status QD3D_CALL Q3Shape_AddElement(
  1160.     TQ3ShapeObject    shape,
  1161.     TQ3ElementType    type,
  1162.     const void        *data);
  1163.  
  1164. QD3D_EXPORT TQ3Status QD3D_CALL Q3Shape_GetElement(
  1165.     TQ3ShapeObject    shape,
  1166.     TQ3ElementType    type,
  1167.     void            *data);
  1168.     
  1169. QD3D_EXPORT TQ3Boolean QD3D_CALL Q3Shape_ContainsElement(
  1170.     TQ3ShapeObject    shape,
  1171.     TQ3ElementType    type);
  1172.  
  1173. QD3D_EXPORT TQ3Status QD3D_CALL Q3Shape_GetNextElementType(
  1174.     TQ3ShapeObject    shape,
  1175.     TQ3ElementType    *type);
  1176.  
  1177. QD3D_EXPORT TQ3Status QD3D_CALL Q3Shape_EmptyElements(
  1178.     TQ3ShapeObject    shape);
  1179.  
  1180. QD3D_EXPORT TQ3Status QD3D_CALL Q3Shape_ClearElement(
  1181.     TQ3ShapeObject    shape,
  1182.     TQ3ElementType    type);
  1183.  
  1184.  
  1185. /******************************************************************************
  1186.  **                                                                             **
  1187.  **                            Color Table Routines                             **
  1188.  **                                                                             **
  1189.  *****************************************************************************/
  1190.  
  1191.  
  1192. QD3D_EXPORT TQ3Status QD3D_CALL Q3Bitmap_Empty(
  1193.     TQ3Bitmap                    *bitmap);
  1194.  
  1195. QD3D_EXPORT unsigned long QD3D_CALL Q3Bitmap_GetImageSize(
  1196.     unsigned long                width,
  1197.     unsigned long                height);
  1198.  
  1199. #ifdef __cplusplus
  1200. }
  1201. #endif  /*  __cplusplus  */
  1202.  
  1203. #if defined(OS_MACINTOSH) && OS_MACINTOSH
  1204.  
  1205. #if defined(__xlc__) || defined(__XLC121__)
  1206.     #pragma options enum=reset
  1207.     #pragma options align=reset
  1208. #elif defined(__MWERKS__)
  1209.     #pragma enumsalwaysint reset
  1210.     #pragma options align=reset
  1211. #elif defined(__MRC__) || defined(__SC__)
  1212.     #if PRAGMA_ENUM_RESET_QD3D
  1213.         #pragma options(pack_enums)
  1214.         #undef PRAGMA_ENUM_RESET_QD3D
  1215.     #endif
  1216.     #pragma options align=reset
  1217. #endif
  1218.  
  1219. #endif  /* OS_MACINTOSH */
  1220.  
  1221. #endif /*  QD3D_h  */
  1222.  
  1223.